package com.promote.hotspot.server.hot;

import lombok.extern.slf4j.Slf4j;
import org.promote.hotspot.common.model.HotKeyModel;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author enping.jep
 * @date 2024/01/08 15:52
 **/
@Component
@Slf4j
public class Producer {
    @Resource
    private HotSpotQueue hotSpotQueue;

    public void push(HotKeyModel model) {
        if (model == null || model.getKey() == null) {
            return;
        }

        //5s前的数据就不处理了,进行超时总数的累计
//        if (System.currentTimeMillis() - model.getCreateTime() > Constant.TIME_OUT) {
//            hotSpotCounter.addExpireTotalCount();
//            return;
//        }

        hotSpotQueue.put(model);//生产数据 阻塞方法
        hotSpotQueue.addTotalOfferCount();//往队列中放了多少数据
    }

}
